<?php

class Admin extends Controller {

	function Admin(){
		parent::Controller();	
		$this->load->model("M_Common","common");
	}
	function index(){
		$data["title"] = "InvoiceSystem";
		$this->load->view('welcome_message', $data);
	}		
	function utilizatori(){
		$data["title"] = "Lista utilizatori";
		$this->load->view('admin/users_list',$data);
	}
	function terms(){
		$this->load->view('admin/terms');
	}
	function contact(){
		$from = $this->input->post('from');
		$subject = $this->input->post('subject');
		$name = $this->input->post('name');
		$message = $this->input->post('message');
		$type = $this->input->post('type');
		
		$this->email->from($from); 	
		$this->email->to('contact@iello.ro');
		$this->email->subject('['. $type .'] '.$subject);
		$this->email->message($message);
		
		if($this->email->send()){
			echo json_encode(array(
			        'success'=> true,
			        'code' => 1			//success
			));											
		} else{
			echo json_encode(array(
			        'success'=> true,
			        'code' => 0			//insuccess
			));		  					
		}		
	}

}
?>